﻿<%@ Page Title="" Language="C#" MasterPageFile="~/UsersMaster.master" AutoEventWireup="true"
    CodeBehind="InsertSellingOrder.aspx.cs" Inherits="SMS.Orders.InsertSellingOrder" %>

<asp:Content ID="Content1" ContentPlaceHolderID="UserHeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="UserMainContent" runat="server">
    <div id="search" class="boxed">
        <h2 class="title" dir="rtl">
            <img src="../App_Themes/Theme/images/Add Item.png" class="img" />
            إضـافة فـاتـورة بيــع جـديـدة</h2>
        <div class="content" dir="rtl">
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="OrderVG" />
            <asp:CustomValidator runat="server" ID="vldtrsOrderItems" ErrorMessage="لا توجــد بيـانات"
                ValidationGroup="OrderVG" />
            <table width="35%">
                <tr>
                    <td>
                        <asp:Label ID="Label1" Text="مـحـل :" runat="server" AssociatedControlID="ddlStocks" />
                    </td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlStocks" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label2" runat="server" Text="العميــل :" />
                    </td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlCustomers" AutoPostBack="true" OnSelectedIndexChanged="ddlCustomers_SelectedIndexChanged" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblDiscountPercentage" runat="server" Text="نســبة الخصــم :" Visible="false" />
                    </td>
                    <td>
                        <asp:TextBox ID="txtDiscountPercentage" runat="server" Text="0.0" 
                            Visible="false" AutoPostBack="True" 
                            ontextchanged="txtDiscountPercentage_TextChanged" />
                        <ajax:FilteredTextBoxExtender runat="server" ID="fltrDiscount" TargetControlID="txtDiscountPercentage"
                            FilterMode="ValidChars" FilterType="Custom" ValidChars="0123456789." />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label3" Text="البـار كــود :" runat="server" AssociatedControlID="txtBarCode" />
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txtBarCode" AutoPostBack="true" OnTextChanged="txtBarCode_TextChanged" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label6" runat="server" Text="Part Number :" />
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txtPartNumber" AutoPostBack="true" 
                            ontextchanged="txtPartNumber_TextChanged" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label4" Text="أســم :" runat="server" AssociatedControlID="txtItemName" />
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txtItemName" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label5" Text="المــاركـة :" runat="server" AssociatedControlID="txtMark" />
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txtMark" AutoPostBack="true" OnTextChanged="txtMark_TextChanged" />
                    </td>
                </tr>
            </table>
            <asp:DataList ID="dlOrderItems" runat="server" EditItemIndex="-1" HeaderStyle-Font-Bold="true"
                OnCancelCommand="dlOrderItems_CancelCommand" OnDeleteCommand="dlOrderItems_DeleteCommand"
                OnEditCommand="dlOrderItems_EditCommand" OnItemCommand="dlOrderItems_ItemCommand"
                OnItemDataBound="dlOrderItems_ItemDataBound"
                onupdatecommand="dlOrderItems_UpdateCommand">
                <HeaderTemplate>
                    <table border="1" width="100%">
                        <tr align="center">
                        <td>
                                <asp:Label ID="Label7" runat="server" Text="Part Number" Font-Bold="true" />
                            </td>
                            <td>
                                <asp:Label runat="server" Text="أسـم المنـتـج" Font-Bold="true" />
                            </td>
                            <td>
                                <asp:Label runat="server" Text="المــاركـة" Font-Bold="true" />
                            </td>
                            <td>
                                <asp:Label runat="server" Text="العدد في المخـزن" Font-Bold="true" />
                            </td>
                            <td>
                                <asp:Label runat="server" Text="الكـمـيـة" Font-Bold="true" />
                            </td>
                            <td>
                                <asp:Label runat="server" Text="سـعـر الوحـدة" Font-Bold="true" />
                            </td>
                            <td>
                                <asp:Label runat="server" Text="الاجمــالي" Font-Bold="true" />
                            </td>
                            <td>
                                <asp:Label runat="server" Text="حـذف" Font-Bold="true" />
                            </td>
                            <td>
                                <asp:Label runat="server" Text="تعـديـل" Font-Bold="true" />
                            </td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr align="center">
                    <td>
                            <asp:Label ID="Label8" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"StockItem.Item.PartNumber") %>' />
                        </td>
                        <td>
                            <asp:Label ID="Label13" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"StockItem.Item.Name") %>' />
                        </td>
                        <td>
                            <asp:Label ID="Label14" runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.StockItem.Item.Mark") %>' />
                        </td>
                        <td>
                            <asp:Label ID="Label15" runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.StockItem.Count") %>' />
                        </td>
                        <td>
                            <asp:Label runat="server" Text='<%#DataBinder.Eval(Container,"DataItem.ItemCount") %>'
                                ID="lblQuantity" />
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblSellingPrice" Text='<%# DataBinder.Eval(Container,"DataItem.UnitPrice") %>' />
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblItemTotal" />
                        </td>
                        <td>
                            <asp:LinkButton runat="server" CommandName="delete" Text="حـذف" ID="lbDelete" 
                            OnClientClick="return confirm('سـوف يتـم حـذف البيــان من الفـاتــورة')" />
                        </td>
                        <td>
                            <asp:LinkButton runat="server" CommandName="edit" Text="تعـديـل" ID="lbEdite" />
                        </td>
                    </tr>
                </ItemTemplate>
                <EditItemTemplate>
                    <tr align="center">
                    <td>
                            <asp:Label ID="Label9" runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.StockItem.Item.PartNumber") %>' />
                        </td>
                        <td>
                            <asp:Label runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.StockItem.Item.Name") %>' />
                        </td>
                        <td>
                            <asp:Label runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.StockItem.Item.Mark") %>' />
                        </td>
                        <td>
                            <asp:Label runat="server" Text='<%#DataBinder.Eval(Container,"DataItem.StockItem.Count") %>' />
                        </td>
                        <td>
                            <asp:TextBox ID="txtQuantity" runat="server" Text='<%#DataBinder.Eval(Container,"DataItem.ItemCount") %>' />
                        </td>
                        <td>
                            <asp:TextBox ID="txtSellingPrice" runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.UnitPrice") %>' />
                        </td>
                        <td>
                        </td>
                        <td>
                            <asp:LinkButton ID="LinkButton1" runat="server" Text="مـوافق" CommandName="update" />
                        </td>
                        <td>
                            <asp:LinkButton ID="LinkButton2" runat="server" Text="الغـاء" CommandName="cancel" />
                        </td>
                    </tr>
                </EditItemTemplate>
                <FooterTemplate>
                    <tr align="center">
                        <td>
                            <asp:Label ID="Label17" runat="server" Text="أجــمالي الفـاتـورة" Font-Bold="true" />
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lblTotal" Font-Bold="true" />
                        </td>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:DataList>
            <asp:Panel ID="Panel1" runat="server" Direction="RightToLeft" GroupingText="الأجمــالي"
                Font-Bold="true">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <table dir="rtl">
                            <tr>
                                <td>
                                    <asp:Label ID="Label18" runat="server" Text="المـدفـوع: " />
                                </td>
                                <td>
                                    <asp:TextBox runat="server" ID="txtPaid" Text="0.0" OnTextChanged="txtPaid_TextChanged"
                                        AutoPostBack="true" />
                                    <ajax:FilteredTextBoxExtender runat="server" ID="fltrPaid" TargetControlID="txtPaid"
                                        FilterType="Custom, Numbers" ValidChars="." />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPaid"
                                        ErrorMessage="أدخـل المـدفـوع" ValidationGroup="OrderVG" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="Label19" runat="server" Text="البـاقي: " />
                                </td>
                                <td>
                                    <asp:Label runat="server" ID="lblChange" Text="0" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Button runat="server" ID="btnTransfer" Text="تحـويـل البـاقي" ValidationGroup="OrderVG" />
                                </td>
                                <td>
                                    <asp:Button runat="server" ID="btnSubmit" Text="طبـاعـة الطلـب" OnClick="btnSubmit_Click"
                                        ValidationGroup="OrderVG" />
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </asp:Panel>
        </div>
    </div>
</asp:Content>
